<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
		<style>
			
		</style>
		<script src="./src/vue.js"></script>
	</head>

	<body>
		<div id="app">
			<button @click.stop="changeMessage">按钮</button>
			<p v-for="item,index in arr">{{item}}</p>
		</div>
		<script>
			// 计划好的对象
			let vm = new Vue({
				el:'#app',
				data: {
					message:'hello,vue',
					arr:[1,2,3]
				},
				methods: {
					changeMessage(){
						// 不能用下标改,监控不到数据的变化
						//this.arr[0] = 10;
						//this.arr.splice(0,1,10)
						// length也不能改变数组
						//this.arr.length = 1;
						//this.arr.splice(1)

						// 重新改写数组
						this.arr = this.arr.concat([1,2,3,4])
					}
				}
			});


		</script>
	</body>
</html>